#pragma once


#define WM_RENDER (WM_USER + 400)
// CD3DApp

class CD3DApp;

class DXGlobal
{
	friend class CD3DApp;
private:
	DXGlobal()
		:m_driverType( D3D_DRIVER_TYPE_UNKNOWN )
		,m_pd3dDevice( NULL)
		,m_pd3dDeviceContext(NULL)
	{}

public:
	D3D_DRIVER_TYPE  DriverType() const {return m_driverType;}
	ID3D11Device*    Device() const {return m_pd3dDevice;}
	ID3D11DeviceContext* DeviceContext() const {return m_pd3dDeviceContext;}

private:
	D3D_DRIVER_TYPE      m_driverType;
	ID3D11Device*          m_pd3dDevice;
	ID3D11DeviceContext*   m_pd3dDeviceContext;
};

class CD3DApp : public CWinAppEx
{
	DECLARE_DYNCREATE(CD3DApp)

protected:
	CD3DApp();           
	virtual ~CD3DApp();

public:
	virtual BOOL InitInstance();
	virtual int ExitInstance();

	virtual	HRESULT OnInitalizeGlobalResource();
	virtual	void	OnDestoryGlobalResource();

	DXGlobal*	DXGlboal() {return &m_DXGlobal;}

private:
	HRESULT CreateDevice();

protected:
	DECLARE_MESSAGE_MAP()

protected:
	DXGlobal	m_DXGlobal;
};


DXGlobal* AfxDXGlobal();